/**
 * 
 */
package org.wolf.core.schema;

import java.io.Serializable;
import java.util.Map;

/**
 * @author 何小锋
 * 
 */
public class DocField implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 名称
	 */
	private String name;

	/**
	 * 额外的参数
	 */
	protected Map<String, String> args;

	/**
	 * 是否分词
	 */
	protected Boolean tokenized;

	/**
	 * 是否多值
	 */
	protected Boolean multiValued;

	/**
	 * 是否索引
	 */
	protected Boolean indexed;

	/**
	 * 是否存储
	 */
	protected Boolean stored;

	/**
	 * 是否必须
	 */
	protected Boolean required;

	/**
	 * 是否二进制
	 */
	protected Boolean binary;

	/**
	 * 是否存储词条向量
	 */
	protected Boolean storeTermVector;

	/**
	 * 是否存储词条位置
	 */
	protected Boolean storeTermPositions;

	/**
	 * 是否存储词条偏移量
	 */
	protected Boolean storeTermOffsets;

	/**
	 * 是否忽略规范
	 */
	protected Boolean omitNorms;

	/**
	 * 是否忽略词频
	 */
	protected Boolean omitTf;

	/**
	 * 没值的时候排序最前面
	 */
	protected Boolean sortMissingFirst;

	/**
	 * 没值的时候排序最后面
	 */
	protected Boolean sortMissingLast;

	/**
	 * 默认值
	 */
	private String defaultValue;

	/**
	 * 字段类型
	 */
	protected FieldType fieldType;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Map<String, String> getArgs() {
		return args;
	}

	public void setArgs(Map<String, String> args) {
		this.args = args;
	}

	public Boolean isTokenized() {
		if (tokenized == null && fieldType != null)
			return fieldType.isTokenized();
		return tokenized;
	}

	public void setTokenized(Boolean tokenized) {
		this.tokenized = tokenized;
	}

	public Boolean isMultiValued() {
		if (multiValued == null && fieldType != null)
			return fieldType.isMultiValued();
		return multiValued;
	}

	public void setMultiValued(Boolean multiValued) {
		this.multiValued = multiValued;
	}

	public Boolean isIndexed() {
		if (indexed == null && fieldType != null)
			return fieldType.isIndexed();
		return indexed;
	}

	public void setIndexed(Boolean indexed) {
		this.indexed = indexed;
	}

	public Boolean isStored() {
		if (stored == null && fieldType != null)
			return fieldType.isStored();
		return stored;
	}

	public void setStored(Boolean stored) {
		this.stored = stored;
	}

	public Boolean isRequired() {
		if (required == null && fieldType != null)
			return fieldType.isRequired();
		return required;
	}

	public void setRequired(Boolean required) {
		this.required = required;
	}

	public Boolean isBinary() {
		if (binary == null && fieldType != null)
			return fieldType.isBinary();
		return binary;
	}

	public void setBinary(Boolean binary) {
		this.binary = binary;
	}

	public Boolean isStoreTermVector() {
		if (storeTermVector == null && fieldType != null)
			return fieldType.isStoreTermVector();
		return storeTermVector;
	}

	public void setStoreTermVector(Boolean storeTermVector) {
		this.storeTermVector = storeTermVector;
	}

	public Boolean isStoreTermPositions() {
		if (storeTermPositions == null && fieldType != null)
			return fieldType.isStoreTermPositions();
		return storeTermPositions;
	}

	public void setStoreTermPositions(Boolean storeTermPositions) {
		this.storeTermPositions = storeTermPositions;
	}

	public Boolean isStoreTermOffsets() {
		if (storeTermOffsets == null && fieldType != null)
			return fieldType.isStoreTermOffsets();
		return storeTermOffsets;
	}

	public void setStoreTermOffsets(Boolean storeTermOffsets) {
		this.storeTermOffsets = storeTermOffsets;
	}

	public Boolean isOmitNorms() {
		if (omitNorms == null && fieldType != null)
			return fieldType.isOmitNorms();
		return omitNorms;
	}

	public void setOmitNorms(Boolean omitNorms) {
		this.omitNorms = omitNorms;
	}

	public Boolean isOmitTf() {
		if (omitTf == null && fieldType != null)
			return fieldType.isOmitTf();
		return omitTf;
	}

	public void setOmitTf(Boolean omitTf) {
		this.omitTf = omitTf;
	}

	public Boolean isSortMissingFirst() {
		if (sortMissingFirst == null && fieldType != null)
			return fieldType.isSortMissingFirst();
		return sortMissingFirst;
	}

	public void setSortMissingFirst(Boolean sortMissingFirst) {
		this.sortMissingFirst = sortMissingFirst;
	}

	public Boolean isSortMissingLast() {
		if (sortMissingLast == null && fieldType != null)
			return fieldType.isSortMissingLast();
		return sortMissingLast;
	}

	public void setSortMissingLast(Boolean sortMissingLast) {
		this.sortMissingLast = sortMissingLast;
	}

	public Boolean isPloyField() {
		if (fieldType != null)
			return fieldType.isPolyField();
		return false;
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}

	public FieldType getFieldType() {
		return fieldType;
	}

	public void setFieldType(FieldType fieldType) {
		this.fieldType = fieldType;
	}

}
